package cn.xinfei.xdecision.common.utils.enums.enginex;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 组件状态枚举
 * Created by maying on 2023/03/02.
 **/
@Getter
@AllArgsConstructor
public enum ComponentStatusEnum {

    NEW(0, "新建"),
    ENABLE(1, "启用"),
    DISABLE(2, "停用");

    private final Integer status;

    private final String name;

    public static ComponentStatusEnum get(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        for (ComponentStatusEnum e : ComponentStatusEnum.values()) {
            if (code.equals(e.getStatus())) {
                return e;
            }
        }
        return null;
    }

}
